#ifndef DOCUMENTMANAGER_H
#define DOCUMENTMANAGER_H

#include "Editor/editor.h"

class Session;
class MainWindow;

class DocumentManager
{
public:
	DocumentManager(Session *newSession);

	//Process an Incoming Change
	void receiveChange(QByteArray changeData);
	void sendChange(QByteArray changeData);

	//Create, Load & Save Files
	void createDocument(Editor::Type type);
	void loadDocument(QString filename);
	void closeDocument(Editor* closeMe);
	void saveSession(QString filename);
	void saveSession(QByteArray&);
        void loadSession(QString filename);
	void loadSession(QByteArray&);

	int numEditors() { return docList.size(); }
	int getLocalUserId();
	Session *getSession() {return session;}
	const QList<Editor*> getDocList() {return docList;}

	void rehighlightAll();	//rehighlights all of the documents

private:
	void addNewDocumentToList(Editor::Type type, QString name="");

	Session *session;
	QList<Editor*> docList;
};

#endif //DOCUMENTMANAGER_H
